package com.yitao.client.constant;

import java.util.HashMap;
import java.util.Map;

public class AppUserEnum {


    /**
     * 性别，0：男，1：女，2：其它
     */
    public enum GenderEnum {

        MAN(0, "男"),
        WOMEN(1, "女"),
        OTHER(2, "其它");

        private static final Map<Integer, GenderEnum> map = new HashMap<>();

        static {
            GenderEnum[] values = GenderEnum.values();
            for (GenderEnum item : values) {
                map.put(item.code, item);
            }
        }

        private final Integer code;
        private final String name;

        private GenderEnum(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static GenderEnum getEnum(Integer code) {
            return map.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }


    /**
     * 用户状态
     */
    public enum UserStatusEnum {

        ENABLE(false, "正常"),
        PROHIBIT(true, "禁用");

        private static final Map<Boolean, UserStatusEnum> map = new HashMap<>();

        static {
            UserStatusEnum[] values = UserStatusEnum.values();
            for (UserStatusEnum item : values) {
                map.put(item.code, item);
            }
        }

        private final Boolean code;
        private final String name;

        private UserStatusEnum(Boolean code, String name) {
            this.code = code;
            this.name = name;
        }

        public static UserStatusEnum getEnum(Integer code) {
            return map.get(code);
        }

        public Boolean getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }
}
